/**
 * 
 */
package core;

import utilidades.ImageUtility;
import utilidades.ViewerData;
import utilidades.ZipUtility;
import utilidades.robot;
import icore.ICorePantalla;

/**
 * @author Elkin Torres
 *
 */
public class CorePantalla implements ICorePantalla{

	private ViewerData viewer;
	private robot robot;
	/**
	 * 
	 */
	private static final long serialVersionUID = 4684516736081418046L;

	/**
	 * @param viewer the viewer to set
	 */
	public void setViewer(ViewerData viewer) {
		this.viewer = viewer;
	}

	/**
	 * @param robot the robot to set
	 */
	public void setRobot(robot robot) {
		this.robot = robot;
	}

	@Override
	public byte[] getPantalla() {
		robot.captureScreen(viewer);
		byte[] tmp = ImageUtility.toByteArray(robot.captureScreen(viewer), viewer.getImageQuality());
		return ZipUtility.compress(tmp, 9);
	}
}
